import requests
import execjs
import js
import hashlib



e ={
    "ts": 1763815939006,
    "pageNo": 1,
    "pageSize": 20,
    "total": 0,
    "AREACODE": "",
    "M_PROJECT_TYPE": "",
    "KIND": "GCJS",
    "GGTYPE": "1",
    "PROTYPE": "",
    "timeType": "6",
    "BeginTime": "2025-05-22 00:00:00",
    "EndTime": "2025-11-22 23:59:59",
    "createTime": ""
}

with open('js/福建公共交易平台.js', 'r') as f:
    code = execjs.compile(f.read())



    r2 = code.call("get_sign",e)
    sign = hashlib.md5(r2.encode('utf-8')).hexdigest()
    print(sign)

    res = requests.post('https://ggzyfw.fj.gov.cn/FwPortalApi/Trade/TradeInfo', json=e, headers={
        'portal-sign': sign,
    })

    print(res.json()['Data'])

    dd = code.call("get_data", res.json()['Data'])
    print(dd)